package com.shouhuobao.take.utils;

import com.iseastar.guojiang.BeeApplication;
import com.shouhuobao.station.R;
import com.shouhuobao.take.model.PostCompanyBackBean;
import com.shouhuobao.take.model.PostCompanyBean;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

import droid.frame.utils.lang.JsonParser;

/**
 * Created by joker on 2017/11/20.
 */
public class ExpressCompanyDataUtils {
    /**
     * 读取json文件获取快递公司相关信息
     *
     * @return
     */
    public static PostCompanyBackBean getExpressCompanyData() {
        try {
            InputStreamReader isr = new InputStreamReader(BeeApplication.getContext().getAssets().open("express.json"), "UTF-8");
            BufferedReader br = new BufferedReader(isr);
            String line;
            StringBuilder builder = new StringBuilder();
            while ((line = br.readLine()) != null) {
                builder.append(line);
            }
            br.close();
            isr.close();
            PostCompanyBackBean backBean = JsonParser.parse(builder.toString(), PostCompanyBackBean.class);
            return backBean;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 获取常用快递公司信息
     *
     * @return
     */
    public static ArrayList<PostCompanyBean> getCommonExpressCompanyData() {
        ArrayList<PostCompanyBean> beans = new ArrayList<>();
        //火箭投递
        PostCompanyBean huoJianBean = new PostCompanyBean();
        huoJianBean.setCode("huojiantoudi");
        huoJianBean.setName("火箭投递");
        huoJianBean.setImageRes(R.drawable.select_hjtd_icon);
        beans.add(huoJianBean);
        //顺丰速运
        PostCompanyBean shunFengBean = new PostCompanyBean();
        shunFengBean.setCode("shunfeng");
        shunFengBean.setName("顺丰速运");
        shunFengBean.setImageRes(R.drawable.select_sf_icon);
        beans.add(shunFengBean);
        //中通快递
        PostCompanyBean zhongTongBean = new PostCompanyBean();
        zhongTongBean.setCode("zhongtong");
        zhongTongBean.setName("中通快递");
        zhongTongBean.setImageRes(R.drawable.select_zt_icon);
        beans.add(zhongTongBean);
        //圆通速递
        PostCompanyBean yuanTongBean = new PostCompanyBean();
        yuanTongBean.setCode("yuantong");
        yuanTongBean.setName("圆通速递");
        yuanTongBean.setImageRes(R.drawable.select_yt_icon);
        beans.add(yuanTongBean);
        //申通快递
        PostCompanyBean shenTongBean = new PostCompanyBean();
        shenTongBean.setCode("shentong");
        shenTongBean.setName("申通快递");
        shenTongBean.setImageRes(R.drawable.select_st_icon);
        beans.add(shenTongBean);
        //百世快递
        PostCompanyBean baiShiBean = new PostCompanyBean();
        baiShiBean.setCode("baishi");
        baiShiBean.setName("百世快递");
        baiShiBean.setImageRes(R.drawable.select_bs_icon);
        beans.add(baiShiBean);
        //韵达快递
        PostCompanyBean yunDaBean = new PostCompanyBean();
        yunDaBean.setCode("yunda");
        yunDaBean.setName("韵达快递");
        yunDaBean.setImageRes(R.drawable.select_yd_icon);
        beans.add(yunDaBean);
        //邮政包裹
        PostCompanyBean youZhengBean = new PostCompanyBean();
        youZhengBean.setCode("youzhengbaoguo");
        youZhengBean.setName("邮政包裹");
        youZhengBean.setImageRes(R.drawable.select_yz_icon);
        beans.add(youZhengBean);
        //京东物流
        PostCompanyBean jingDongBean = new PostCompanyBean();
        jingDongBean.setCode("jingdong");
        jingDongBean.setName("京东物流");
        jingDongBean.setImageRes(R.drawable.select_jd_icon);
        beans.add(jingDongBean);
        //唯品会
        PostCompanyBean weiPinBean = new PostCompanyBean();
        weiPinBean.setCode("weipin");
        weiPinBean.setName("唯品会");
        weiPinBean.setImageRes(R.drawable.select_wph_icon);
        beans.add(weiPinBean);
        //苏宁电商自营
        PostCompanyBean suNingBean = new PostCompanyBean();
        suNingBean.setCode("suning");
        suNingBean.setName("苏宁电商自营");
        suNingBean.setImageRes(R.drawable.select_sn_icon);
        beans.add(suNingBean);
        //天天快递
        PostCompanyBean tianTianBean = new PostCompanyBean();
        tianTianBean.setCode("tiantian");
        tianTianBean.setName("天天快递");
        tianTianBean.setImageRes(R.drawable.select_tt_icon);
        beans.add(tianTianBean);
        //德邦物流
        PostCompanyBean deBangBean = new PostCompanyBean();
        deBangBean.setCode("debang");
        deBangBean.setName("德邦物流");
        deBangBean.setImageRes(R.drawable.select_db_icon);
        beans.add(deBangBean);
        //宅急送
        PostCompanyBean zhaiJiSongBean = new PostCompanyBean();
        zhaiJiSongBean.setCode("zhaijisong");
        zhaiJiSongBean.setName("宅急送");
        zhaiJiSongBean.setImageRes(R.drawable.select_zjs_icon);
        beans.add(zhaiJiSongBean);
        //全峰快递
        PostCompanyBean quanFengBean = new PostCompanyBean();
        quanFengBean.setCode("quanfeng");
        quanFengBean.setName("全峰快递");
        quanFengBean.setImageRes(R.drawable.select_qf_icon);
        beans.add(quanFengBean);
        //其他快递
        PostCompanyBean otherBean = new PostCompanyBean();
        otherBean.setCode("other");
        otherBean.setName("其他快递");
        otherBean.setImageRes(R.drawable.select_qt_icon);
        beans.add(otherBean);
        return beans;
    }

    /**
     * 获取所有快递公司信息
     *
     * @return
     */
    public static ArrayList<PostCompanyBean> getAllExpressCompanyData() {
        ArrayList<PostCompanyBean> beans = new ArrayList<>();
        //安能快递
        PostCompanyBean anNengBean = new PostCompanyBean();
        anNengBean.setCode("anneng");
        anNengBean.setName("安能快递");
        anNengBean.setImageRes(R.drawable.select_anneng_icon);
        beans.add(anNengBean);
        //安信达
        PostCompanyBean anXinDaBean = new PostCompanyBean();
        anXinDaBean.setCode("anxinda");
        anXinDaBean.setName("安信达");
        anXinDaBean.setImageRes(R.drawable.select_anxinda_icon);
        beans.add(anXinDaBean);
        //邦送物流
        PostCompanyBean bangSongBean = new PostCompanyBean();
        bangSongBean.setCode("bangsong");
        bangSongBean.setName("邦送物流");
        bangSongBean.setImageRes(R.drawable.select_bangsong_icon);
        beans.add(bangSongBean);
        //百世快递
        PostCompanyBean baiShiBean = new PostCompanyBean();
        baiShiBean.setCode("baishi");
        baiShiBean.setName("百世快递");
        baiShiBean.setImageRes(R.drawable.select_bs_icon);
        beans.add(baiShiBean);
        //德邦物流
        PostCompanyBean deBangBean = new PostCompanyBean();
        deBangBean.setCode("debang");
        deBangBean.setName("德邦物流");
        deBangBean.setImageRes(R.drawable.select_db_icon);
        beans.add(deBangBean);
        //当当自营
        PostCompanyBean dangDangZiYingBean = new PostCompanyBean();
        dangDangZiYingBean.setCode("dangdangziying");
        dangDangZiYingBean.setName("当当自营");
        dangDangZiYingBean.setImageRes(R.drawable.select_dang_icon);
        beans.add(dangDangZiYingBean);
        //DHL快递
        PostCompanyBean dhlBean = new PostCompanyBean();
        dhlBean.setCode("dhl");
        dhlBean.setName("DHL快递");
        dhlBean.setImageRes(R.drawable.select_dhl_icon);
        beans.add(dhlBean);
        //大田物流
        PostCompanyBean daTianBean = new PostCompanyBean();
        daTianBean.setCode("datian");
        daTianBean.setName("大田物流");
        daTianBean.setImageRes(R.drawable.select_datian_icon);
        beans.add(daTianBean);
        //EMS国内
        PostCompanyBean emsGuoNeiBean = new PostCompanyBean();
        emsGuoNeiBean.setCode("emsguonei");
        emsGuoNeiBean.setName("EMS国内");
        emsGuoNeiBean.setImageRes(R.drawable.select_ems_icon);
        beans.add(emsGuoNeiBean);
        //EMS国际
        PostCompanyBean emsGuoJiBean = new PostCompanyBean();
        emsGuoJiBean.setCode("emsguoji");
        emsGuoJiBean.setName("EMS国际");
        emsGuoJiBean.setImageRes(R.drawable.select_ems_icon);
        beans.add(emsGuoJiBean);
        //FedEx联邦快递
        PostCompanyBean fedExBean = new PostCompanyBean();
        fedExBean.setCode("fedex");
        fedExBean.setName("FedEx联邦快递");
        fedExBean.setImageRes(R.drawable.select_lianbang_icon);
        beans.add(fedExBean);
        //国际小包
        PostCompanyBean guoJiXiaoBaoBean = new PostCompanyBean();
        guoJiXiaoBaoBean.setCode("guojixiaobao");
        guoJiXiaoBaoBean.setName("国际小包");
        guoJiXiaoBaoBean.setImageRes(R.drawable.select_guojixiaobao_icon);
        beans.add(guoJiXiaoBaoBean);
        //共速达
        PostCompanyBean gongSuDaBean = new PostCompanyBean();
        gongSuDaBean.setCode("gongsuda");
        gongSuDaBean.setName("共速达");
        gongSuDaBean.setImageRes(R.drawable.select_gongsuda_icon);
        beans.add(gongSuDaBean);
        //国通快递
        PostCompanyBean guoTongBean = new PostCompanyBean();
        guoTongBean.setCode("guotong");
        guoTongBean.setName("国通快递");
        guoTongBean.setImageRes(R.drawable.select_guotong_icon);
        beans.add(guoTongBean);
        //汇强快递
        PostCompanyBean huiQiangBean = new PostCompanyBean();
        huiQiangBean.setCode("huiqiang");
        huiQiangBean.setName("汇强快递");
        huiQiangBean.setImageRes(R.drawable.select_huiqiang_icon);
        beans.add(huiQiangBean);
        //京东物流
        PostCompanyBean jingDongBean = new PostCompanyBean();
        jingDongBean.setCode("jingdong");
        jingDongBean.setName("京东物流");
        jingDongBean.setImageRes(R.drawable.select_jd_icon);
        beans.add(jingDongBean);
        //佳吉快运
        PostCompanyBean jiaJiKuaiYunBean = new PostCompanyBean();
        jiaJiKuaiYunBean.setCode("jiajikuaiyun");
        jiaJiKuaiYunBean.setName("佳吉快运");
        jiaJiKuaiYunBean.setImageRes(R.drawable.select_jiaji_icon);
        beans.add(jiaJiKuaiYunBean);
        //佳怡物流
        PostCompanyBean jiaYiBean = new PostCompanyBean();
        jiaYiBean.setCode("jiayiwuliu");
        jiaYiBean.setName("佳怡物流");
        jiaYiBean.setImageRes(R.drawable.select_jiayi_icon);
        beans.add(jiaYiBean);
        //快捷速递
        PostCompanyBean kuaiJieSuDiBean = new PostCompanyBean();
        kuaiJieSuDiBean.setCode("kuaijiesudi");
        kuaiJieSuDiBean.setName("快捷速递");
        kuaiJieSuDiBean.setImageRes(R.drawable.select_kuaijiesudi_icon);
        beans.add(kuaiJieSuDiBean);
        //火箭投递
        PostCompanyBean huoJianBean = new PostCompanyBean();
        huoJianBean.setCode("huojiantoudi");
        huoJianBean.setName("火箭投递");
        huoJianBean.setImageRes(R.drawable.select_hjtd_icon);
        beans.add(huoJianBean);
        //龙邦速递
        PostCompanyBean longBangSuDiBean = new PostCompanyBean();
        longBangSuDiBean.setCode("longbangsudi");
        longBangSuDiBean.setName("龙邦速递");
        longBangSuDiBean.setImageRes(R.drawable.select_longbangsudi_icon);
        beans.add(longBangSuDiBean);
        //能达速递
        PostCompanyBean nengDaSuDiBean = new PostCompanyBean();
        nengDaSuDiBean.setCode("nengdasudi");
        nengDaSuDiBean.setName("能达速递");
        nengDaSuDiBean.setImageRes(R.drawable.select_nengdakuaidi_icon);
        beans.add(nengDaSuDiBean);
        //品骏快递
        PostCompanyBean pinJunKuaiDiBean = new PostCompanyBean();
        pinJunKuaiDiBean.setCode("pinjunkuaidi");
        pinJunKuaiDiBean.setName("品骏快递");
        pinJunKuaiDiBean.setImageRes(R.drawable.select_pj_icon);
        beans.add(pinJunKuaiDiBean);
        //全峰快递
        PostCompanyBean quanFengBean = new PostCompanyBean();
        quanFengBean.setCode("quanfeng");
        quanFengBean.setName("全峰快递");
        quanFengBean.setImageRes(R.drawable.select_qf_icon);
        beans.add(quanFengBean);
        //全日通
        PostCompanyBean quanRiTongBean = new PostCompanyBean();
        quanRiTongBean.setCode("quanritong");
        quanRiTongBean.setName("全日通");
        quanRiTongBean.setImageRes(R.drawable.select_quanritong_icon);
        beans.add(quanRiTongBean);
        //其他快递
        PostCompanyBean otherBean = new PostCompanyBean();
        otherBean.setCode("other");
        otherBean.setName("其他快递");
        otherBean.setImageRes(R.drawable.select_qt_icon);
        beans.add(otherBean);
        //全一快递
        PostCompanyBean quanYiKuaiDiBean = new PostCompanyBean();
        quanYiKuaiDiBean.setCode("quanyikuaidi");
        quanYiKuaiDiBean.setName("全一快递");
        quanYiKuaiDiBean.setImageRes(R.drawable.select_quanyi_icon);
        beans.add(quanYiKuaiDiBean);
        //如风达
        PostCompanyBean ruFengDaBean = new PostCompanyBean();
        ruFengDaBean.setCode("rufengda");
        ruFengDaBean.setName("如风达");
        ruFengDaBean.setImageRes(R.drawable.select_rufengda_icon);
        beans.add(ruFengDaBean);
        //速尔快递
        PostCompanyBean suErKuaiDiBean = new PostCompanyBean();
        suErKuaiDiBean.setCode("suerkuaidi");
        suErKuaiDiBean.setName("速尔快递");
        suErKuaiDiBean.setImageRes(R.drawable.select_suerkuaidi_icon);
        beans.add(suErKuaiDiBean);
        //顺丰速运
        PostCompanyBean shunFengBean = new PostCompanyBean();
        shunFengBean.setCode("shunfeng");
        shunFengBean.setName("顺丰速运");
        shunFengBean.setImageRes(R.drawable.select_sf_icon);
        beans.add(shunFengBean);
        //苏宁电商自营
        PostCompanyBean suNingBean = new PostCompanyBean();
        suNingBean.setCode("suning");
        suNingBean.setName("苏宁电商自营");
        suNingBean.setImageRes(R.drawable.select_sn_icon);
        beans.add(suNingBean);
        //申通快递
        PostCompanyBean shenTongBean = new PostCompanyBean();
        shenTongBean.setCode("shentong");
        shenTongBean.setName("申通快递");
        shenTongBean.setImageRes(R.drawable.select_st_icon);
        beans.add(shenTongBean);
        //天地华宇
        PostCompanyBean tianDiHuaYuBean = new PostCompanyBean();
        tianDiHuaYuBean.setCode("tiandihuayu");
        tianDiHuaYuBean.setName("天地华宇");
        tianDiHuaYuBean.setImageRes(R.drawable.select_huayu_icon);
        beans.add(tianDiHuaYuBean);
        //TNT快递
        PostCompanyBean TNTKuaiDiBean = new PostCompanyBean();
        TNTKuaiDiBean.setCode("tntkuaidi");
        TNTKuaiDiBean.setName("TNT快递");
        TNTKuaiDiBean.setImageRes(R.drawable.select_tnt_icon);
        beans.add(TNTKuaiDiBean);
        //天天快递
        PostCompanyBean tianTianBean = new PostCompanyBean();
        tianTianBean.setCode("tiantian");
        tianTianBean.setName("天天快递");
        tianTianBean.setImageRes(R.drawable.select_tt_icon);
        beans.add(tianTianBean);
        //万博
        PostCompanyBean wanBoBean = new PostCompanyBean();
        wanBoBean.setCode("wanbo");
        wanBoBean.setName("万博");
        wanBoBean.setImageRes(R.drawable.select_wb_icon);
        beans.add(wanBoBean);
        //唯品会
        PostCompanyBean weiPinBean = new PostCompanyBean();
        weiPinBean.setCode("weipin");
        weiPinBean.setName("唯品会");
        weiPinBean.setImageRes(R.drawable.select_wph_icon);
        beans.add(weiPinBean);
        //UPS快递
        PostCompanyBean upsBean = new PostCompanyBean();
        upsBean.setCode("ups");
        upsBean.setName("UPS快递");
        upsBean.setImageRes(R.drawable.select_ups_icon);
        beans.add(upsBean);
        //USPS美国邮政
        PostCompanyBean uspsBean = new PostCompanyBean();
        uspsBean.setCode("usps");
        uspsBean.setName("USPS美国邮政");
        uspsBean.setImageRes(R.drawable.select_usps_icon);
        beans.add(uspsBean);
        //新邦物流
        PostCompanyBean xinBangWuLiuBean = new PostCompanyBean();
        xinBangWuLiuBean.setCode("xinbangwuliu");
        xinBangWuLiuBean.setName("新邦物流");
        xinBangWuLiuBean.setImageRes(R.drawable.select_xinbang_icon);
        beans.add(xinBangWuLiuBean);
        //新蛋物流
        PostCompanyBean xinDanWuLiuBean = new PostCompanyBean();
        xinDanWuLiuBean.setCode("xindanwuliu");
        xinDanWuLiuBean.setName("新蛋物流");
        xinDanWuLiuBean.setImageRes(R.drawable.select_xindanwuliu_icon);
        beans.add(xinDanWuLiuBean);
        //韵达快递
        PostCompanyBean yunDaBean = new PostCompanyBean();
        yunDaBean.setCode("yunda");
        yunDaBean.setName("韵达快递");
        yunDaBean.setImageRes(R.drawable.select_yd_icon);
        beans.add(yunDaBean);
        //优速快递
        PostCompanyBean youSuKuaiDiBean = new PostCompanyBean();
        youSuKuaiDiBean.setCode("yousukuaidi");
        youSuKuaiDiBean.setName("优速快递");
        youSuKuaiDiBean.setImageRes(R.drawable.select_yousukuaidi_icon);
        beans.add(youSuKuaiDiBean);
        //圆通速递
        PostCompanyBean yuanTongBean = new PostCompanyBean();
        yuanTongBean.setCode("yuantong");
        yuanTongBean.setName("圆通速递");
        yuanTongBean.setImageRes(R.drawable.select_yt_icon);
        beans.add(yuanTongBean);
        //邮政包裹
        PostCompanyBean youZhengBaoGuoBean = new PostCompanyBean();
        youZhengBaoGuoBean.setCode("youzhengbaoguo");
        youZhengBaoGuoBean.setName("邮政包裹");
        youZhengBaoGuoBean.setImageRes(R.drawable.select_yz_icon);
        beans.add(youZhengBaoGuoBean);
        //宅急送
        PostCompanyBean zhaiJiSongBean = new PostCompanyBean();
        zhaiJiSongBean.setCode("zhaijisong");
        zhaiJiSongBean.setName("宅急送");
        zhaiJiSongBean.setImageRes(R.drawable.select_zjs_icon);
        beans.add(zhaiJiSongBean);
        //中邮物流
        PostCompanyBean youZhengBean = new PostCompanyBean();
        youZhengBean.setCode("zhongyouwuliu");
        youZhengBean.setName("中邮物流");
        youZhengBean.setImageRes(R.drawable.select_zhongyou_icon);
        beans.add(youZhengBean);
        //中通快递
        PostCompanyBean zhongTongBean = new PostCompanyBean();
        zhongTongBean.setCode("zhongtong");
        zhongTongBean.setName("中通快递");
        zhongTongBean.setImageRes(R.drawable.select_zt_icon);
        beans.add(zhongTongBean);
        //中铁快运
        PostCompanyBean zhongTieKuaiYunBean = new PostCompanyBean();
        zhongTieKuaiYunBean.setCode("zhongtiekuaiyun");
        zhongTieKuaiYunBean.setName("中铁快运");
        zhongTieKuaiYunBean.setImageRes(R.drawable.select_zhongtiekuaiyun_icon);
        beans.add(zhongTieKuaiYunBean);
        return beans;
    }
}
